﻿using System;
using System.Collections.Generic;
using System.Text;
using StockTrader.BusinessService.DataContract.Mortgate;

namespace MortgageMonitor.DDL
{
    public class CustomerFS
    {
        public string AccountNo { set; get; }
        public string Name { set; get; }
        public decimal StockHoldingValue { set; get; }
        public decimal CashHolding { set; get; }
        public decimal PreLoan { set; get; }
        public decimal AccumulateLoan { set; get; }
        private List<ContractData> _Contracts = new List<ContractData>();
        public List<ContractData> Contracts
        {
            set
            {
                _Contracts = value;
            }
            get
            {
                return this._Contracts;
            }
        }


        public decimal LoanRatio
        {
            get 
            {
                if ((StockHoldingValue + CashHolding) > 0)
                    return AccumulateLoan / (StockHoldingValue + CashHolding);
                else
                    return 0;
            }
        }
        public decimal LoanTotalRatio
        {
            get 
            {
                if (TotalLoan > 0)
                    return AccumulateLoan / TotalLoan;
                else
                    return 0;
            }
        }
        public decimal TotalLoan { set; get; }
        public CustomerFS() { }

        public CustomerFS(List<ContractData> contractno, string accountno, string name, decimal stockvalue, decimal cashvalue, decimal preloan, decimal accumulate, decimal loanratio, decimal loantotalratio, decimal totalloan) 
        {
            Contracts = contractno;
            AccountNo = accountno;
            Name = name;
            StockHoldingValue = stockvalue;
            CashHolding = cashvalue;
            PreLoan = preloan;
            AccumulateLoan = accumulate;
            TotalLoan = totalloan;
        }
    }
}
